home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 114_01.zip / GUIDE.DOC < prev    next >
Text File  |  1993-06-01  |  21KB  |  823 lines

  1. .cm screen editor:  user guide
  2. .cm source:  guide.doc
  3. .he 'guide.doc''September 8, 1981'
  4. .fo ''-#-''
  5.  
  6. .ul
  7. Basic terms
  8.  
  9.    The terms, mode, command, special character,
  10. prompt line, cursor, the current line, and the buffer
  11. are used extensively in this documentation.
  12. You will learn about the screen editor more easily if you
  13. become familiar with these terms.
  14. Let's look at each in turn.
  15.  
  16. .ti +3
  17. The screen editor is comprised of several
  18. .ul
  19. modes.
  20. You can switch between modes,
  21. but the editor can't be in two modes at the same time.
  22. The editor behaves differently in each mode,
  23. so you use each mode to do a particular type
  24. of editing.
  25.  
  26. .ti +3
  27. There are three modes:
  28. edit mode, command mode and insert mode.
  29. You use edit mode for making
  30. small changes in many different lines.
  31. Command mode is used for making larger
  32. (hence potentially more dangerous)
  33. changes to the whole file you are editing.
  34. You must be in command mode to do anything
  35. that will change files on the disk.
  36. You use insert mode for making a series of
  37. insertions into the text.
  38. First drafts are often entered in this mode.
  39.  
  40. .ti +3
  41. You use
  42. .ul
  43. commands
  44. to make things happen in each mode.
  45. Which commands you can use depends on what mode you
  46. are in.
  47. Do not confuse the terms "commands" and
  48. "command mode".
  49. Every mode has a set of commands which
  50. you can use in that mode.
  51. Command mode has its own set of commands.
  52.  
  53. .ti +3
  54. .ul
  55. Special characters
  56. are one-letter commands.
  57. Special characters must be control keys, so
  58. you can use these commands in places where the
  59. editor might not otherwise expect a command.
  60.  
  61. .ti +3
  62. The
  63. .ul
  64. prompt line
  65. is the top line of the screen.
  66. It tells you things like what line you
  67. are editing and what mode you are in.
  68. If you get confused about what mode you are in
  69. you can always glance at the prompt line
  70. and get your bearings.
  71.  
  72. .ti +3
  73. Several edit-mode commands 
  74. consist of two or more letters.
  75. These edit-mode commands are called
  76. .ul
  77. extended commands.
  78. After you type the first letter of such a command,
  79. but before you type the last letter, the
  80. prompt line will indicate that you must type one more
  81. letter to finish the extended command.
  82. For example, 
  83. after you type an "s" to enter the edit-mode search command
  84. the prompt line's mode field will contain
  85. 'edit: search'.
  86.  
  87. .ti +3
  88. The
  89. .ul
  90. cursor
  91. is a distinctive character on the screen.
  92. On most video terminals
  93. this marker is a character shown with reverse
  94. video.
  95. In command mode you always type commands on the bottom
  96. line so the cursor is always on the bottom line.
  97. In edit mode and insert mode
  98. the cursor is always on the current line.
  99.  
  100. .ti +3
  101. The
  102. .ul
  103. current line
  104. is the only line you can edit.
  105. In command mode the current line may not be shown on
  106. the screen, but in edit and insert modes
  107. the current line is shown and it contains the cursor.
  108. If you want to make a change to a line you must first
  109. move the cursor to that line.
  110.  
  111. .ti +3
  112. The
  113. .ul
  114. buffer
  115. is a part of the computer's storage which holds the file
  116. you are editing.
  117. In order to edit a disk file, you must first read the disk
  118. file into the buffer using the load command.
  119. As you edit the file the changes you make are made only
  120. to the buffer, not to your disk file.
  121. Before you end your editing session you must copy the buffer
  122. back to a disk file using the save or resave commands.
  123. The editor keeps track of whether you have done this;
  124. it won't let you forget to save your work.
  125.  
  126. .ti +3
  127. The
  128. .ul
  129. window
  130. is a part of the screen which shows a portion
  131. of the buffer.
  132. In edit and insert modes the window fills all of
  133. the screen except the prompt line.
  134. You can think of the file as a scroll of parchment which
  135. unwinds under the window as you move the cursor.
  136. The window is not shown in command mode.
  137.  
  138. .ti +3
  139. Now let's look more closely at the editor's commands.
  140. We'll start with special characters, which are commands
  141. that may be used in either insert or edit modes.
  142. Then we will look at other commands which are unique to
  143. a particular mode.
  144.  
  145. .ul
  146. Special Characters
  147.  
  148. .ti +3
  149. Special characters act the same in all modes.
  150. Special characters must be control characters so that
  151. the editor may always distinguish special characters from
  152. regular text.
  153.  
  154. .ti +3
  155. There are 14 special characters;
  156. all 14 may be used in either edit mode or insert mode.
  157. Only a few may be used in command mode.
  158.  
  159. .ti +3
  160. You can use the configuration program to choose
  161. which keys on your keyboard to use for each
  162. special character.
  163. Thus, I won't be able to
  164. be specific about what key on your keyboard you will actually
  165. hit in order to type, for instance, the down key.
  166. I'll often refer to special characters as special keys;
  167. for example, I'll call the down special character the
  168. down key.
  169.  
  170. .ti +3
  171. The
  172. .ul
  173. left and right keys
  174. just move the cursor.
  175. They do not cause changes to lines.
  176. These keys are always "anchored" to the current line;
  177. you can't move off the current line by using these keys.
  178. If you hit the right key while the cursor
  179. is at the right margin,
  180. nothing will happen.
  181. Similarly, nothing will happen if you hit the
  182. left key while the cursor is at the left margin.
  183.  
  184. .ti +3
  185. The
  186. .ul
  187. up and down keys
  188. move the cursor up and down
  189. on the screen.
  190. You can't move the cursor above line 1 of the file, nor can you
  191. move the cursor below the last line of the file.
  192. Both these keys also switch the editor to edit mode.
  193.  
  194. .ti +3
  195. The
  196. .ul
  197. insert up key
  198. inserts a blank line above the current line
  199. while the
  200. .ul
  201. insert down key
  202. inserts a blank line below the current line.
  203. Both these keys also switch the editor to insert mode.
  204.  
  205. .ti +3
  206. The
  207. .ul
  208. delete character key
  209. deletes the character to the left of the cursor.
  210. This key is anchored to the current line;
  211. nothing is deleted if the cursor is at the left margin.
  212. The
  213. .ul
  214. delete line key
  215. deletes the entire line on which the cursor rests.
  216.  
  217. .ti +3
  218. The
  219. .ul
  220. undo key
  221. always undoes whatever
  222. editing you have done on the current line since
  223. the last time the cursor came to the current line.
  224.  
  225. .ti +3
  226. The
  227. .ul
  228. insert key
  229. switches the editor to insert mode.
  230. Similarly, the
  231. .ul
  232. command key
  233. switches the editor to command mode and the
  234. .ul
  235. edit key
  236. switches the editor to edit mode.
  237.  
  238. .ti +3
  239. The
  240. .ul
  241. split key
  242. splits the current line into two pieces.
  243. Everything to the left of the cursor stays right where it is.
  244. All other characters are moved from the current line to
  245. a new line which is created below the original line.
  246.  
  247. .ti +3
  248. The
  249. .ul
  250. join key
  251. is the opposite of the split key;
  252. it combines two lines into one line.
  253. The join key appends the current line to the line above it,
  254. then deletes the lower line.
  255.  
  256. .ul
  257. Edit Mode
  258.  
  259. .ti +3
  260. Edit-mode commands are normal letters; you don't need
  261. to use special keys.
  262. This speeds typing.
  263. You can, however, use the special keys in edit mode if you
  264. want to.
  265.  
  266. .ti +3
  267. Besides the special characters you can use
  268. the following one-letter edit-mode commands:
  269. space, b, c, d, e, g, i, k, s, u, and x.
  270. These letters stand for 
  271. begin, command, down, end, go, insert, kill,
  272. search, up, and eXchange.
  273. Note that all these commands may be typed either
  274. in upper case or in lower case.
  275. Letters which are neither edit-mode commands
  276. nor special keys are simply ignored.
  277. The following paragraphs explain what these
  278. commands do in greater detail.
  279.  
  280. .ti +3
  281. The
  282. .ul
  283. space bar
  284. moves the cursor right one column.
  285. Nothing happens if the cursor is already
  286. on the rightmost column of the screen.
  287.  
  288. .ti +3
  289. The
  290. .ul
  291. b command
  292. puts the cursor at the beginning
  293. (left hand margin) of the line.
  294.  
  295. .ti +3
  296. The
  297. .ul
  298. c command
  299. switches the editor to command mode.
  300.  
  301. .ti +3
  302. The
  303. .ul
  304. d command
  305. causes the cursor to move down rapidly.
  306. The cursor keeps moving until it reaches the last line
  307. of the file or until you type any key.
  308.  
  309. .ti +3
  310. The
  311. .ul
  312. e command
  313. moves the cursor to the right end of the line.
  314.  
  315. .ti +3
  316. The
  317. .ul
  318. i command
  319. switches the editor to insert mode.
  320.  
  321. .ti +3
  322. The
  323. .ul
  324. g command
  325. moves the cursor to another line.
  326. The g command is an extended command;
  327. after you type the g the cursor will move to the prompt line.
  328. The prompt line will show 'edit: goto:'
  329. Now type a line number followed by a carriage return.
  330. The cursor will move to the line whose number you typed.
  331. If you do not type a valid number the g command does nothing.
  332. Leading blanks or minus signs are not allowed.
  333. The cursor will move to the last line of the buffer if
  334. the number you type is larger than the number of lines
  335. in the buffer.
  336.  
  337. .ti +3
  338. The
  339. .ul
  340. k command
  341. is a two-letter command.
  342. The second letter you type
  343. (the first character after the k)
  344. is a search character.
  345. The k command deletes from the cursor up to
  346. but not including the next occurence of the search
  347. character to the right of the cursor.
  348. Everything from the cursor to the end of the line
  349. is deleted if the search character does not
  350. appear to the right of the cursor on the current line.
  351. After you hit the k and before you hit the
  352. search character the prompt line will show
  353. 'edit: kill'.
  354. If you wish to cancel the k command you can
  355. hit any control character.
  356. The k command will be stopped and no deletion
  357. will be made.
  358.  
  359. .ti +3
  360. The
  361. .ul
  362. s command
  363. is another two-letter command.
  364. The second character you type 
  365. (the first character after the s)
  366. is a search character.
  367. The s command moves the cursor to the next
  368. occurence of the search character which
  369. appears to the right of the cursor.
  370. The cursor moves to the end of the current
  371. line if the search character does not occur
  372. to the right of the cursor.
  373. After you hit the s and before you hit the
  374. search character the prompt line will show
  375. 'edit: search'.
  376.  
  377. .ti +3
  378. The
  379. .ul
  380. u command
  381. moves the cursor up rapidly.
  382. The cursor keeps moving until it reaches the first line
  383. of the file or until you hit any key.
  384.  
  385. .ti +3
  386. The
  387. .ul
  388. x command
  389. is another two-letter command.
  390. The second character you type replaces the character
  391. under the cursor.
  392. The prompt line will show 'edit: eXchange'
  393. until you hit the second character.
  394. If you hit a control character no change is made
  395. and the x command is cancelled.
  396.  
  397. .ul
  398. insert mode
  399.  
  400. .ti +3
  401. Use insert mode to insert many lines of text at once.
  402. In insert mode anything you type (except special keys)
  403. will be inserted into the text to the left of the cursor.
  404. You may use special keys in insert mode exactly as in
  405. edit mode.
  406.  
  407. .ul
  408. command mode
  409.  
  410. .ti +3
  411. You use command mode to do potentially dangerous
  412. things like making multiple
  413. changes to the buffer or like updating your files.
  414. For this reason, all command-mode commands require you
  415. to type several characters with a carriage return at the
  416. end.
  417.  
  418. .ti +3
  419. The editor starts off in command mode after you invoke
  420. it from your operating system.
  421.  
  422. .ti +3
  423. You may use either the edit key or the insert key to exit
  424. from command mode.
  425. You can also use the
  426. g command-mode command or the find command-mode command
  427. to leave command mode.
  428. When the editor leaves command mode the screen is redrawn
  429. to show the current line.
  430.  
  431. .ti +3
  432. The cursor is on the bottom line of the screen
  433. whenever the editor is in command mode.
  434. This line is called the command line.
  435. As you type commands, what you type will be shown on this line.
  436. Use either the delete character key or the right key to
  437. delete the last character you typed.
  438. Use the undo key to delete the entire
  439. command line.
  440.  
  441. .ti +3
  442. Several command-mode commands take arguments.
  443. There are three types of arguments: range arguments,
  444. file names and line numbers.
  445. In the description below, range arguments will be denoted
  446. by <line range>, file name arguments
  447. will be denoted by <filename> and line numbers will be denoted
  448. by <n>.
  449.  
  450. .ti +3
  451. Range arguments denote the range of lines in the
  452. buffer for which a command will take effect.
  453. For example,
  454.  
  455. .ti +10
  456. list 25 50
  457.  
  458. means list all lines from line 25 to line 50 inclusive,
  459.  
  460. .ti +10
  461. list
  462.  
  463. means list all the lines of the buffer, and
  464.  
  465. .ti +10
  466. list 300
  467.  
  468. means list line 300 and all following lines.
  469. Range arguments, if present, must be nonnegative integers.
  470. If two numbers are entered, the first must be no larger than
  471. the second.
  472. 0 is equivalent to 1.
  473. A number larger than the largest line number is equivalent
  474. to the largest line number.
  475.  
  476. .ti +3
  477. Filename arguments are the name of a file to be
  478. used in a command.
  479. For example,
  480.  
  481. .ti +10
  482. load myfile.doc
  483.  
  484. causes the file myfile.doc to replace whatever is in the
  485. buffer.
  486. Note that no quotation marks are used around filename
  487. arguments.
  488. Filename arguments optionally may be preceded by disk drive
  489. names.
  490. For example,
  491.  
  492. .ti +10
  493. load b:myfile.doc
  494.  
  495. loads the buffer from the file myfile.doc which must
  496. be found on drive b.
  497.  
  498. .ti +3
  499. The editor protects you from destroying the buffer
  500. unintentionally.
  501. If a command would cause the buffer to be erased and you
  502. have not already saved the buffer on a disk file the editor
  503. will ask:
  504.  
  505. .ti +10
  506. buffer not saved.  proceed ?
  507.  
  508. If you type y or Y the command will be done and the buffer
  509. will be erased.
  510. If you type anything else no change will be made to the buffer
  511. and the message 'cancelled' will be printed on the screen.
  512. Note however, that the delete command does
  513. .ul
  514. not
  515. protect you in this way.
  516. Use the delete command with caution.
  517.  
  518. .ti +3
  519. You may interrupt or cancel the change, find, list and search
  520. commands.
  521. If you type any character
  522. .ul
  523. except
  524. a blank the command will be cancelled immediately.
  525. If you type a blank the command will be temporarily suspended.
  526. Type another blank to continue or any other character to
  527. cancel the command.
  528.  
  529. .ti +3
  530. The following paragraphs discuss all the command-mode commands.
  531.  
  532. append <filename>
  533.  
  534. .ti +3
  535. The append command inserts the named file into the
  536. buffer after the current line.
  537. In other words, the position of the cursor affects where the
  538. file will be inserted.
  539. This command adds to the buffer;
  540. it does not delete what is already there.
  541.  
  542. change <line range>
  543.  
  544. .ti +3
  545. The change command searches all lines in <line range>
  546. for an instance of a search mask.
  547. If the search mask is found it is replaced by the change mask.
  548. After you type  change <line range> the command will ask:
  549.  
  550. .ti +10
  551. search mask ?
  552.  
  553. At this point type the pattern you are searching for,
  554. followed by a carriage return.
  555. Then you will be asked:
  556.  
  557. .ti +10
  558. change mask ?
  559.  
  560. Now you type the pattern you want the search mask to be
  561. replaced by.
  562. For example,
  563.  
  564. .in +10
  565. change 100 300
  566. .br
  567. search mask ?  abc
  568. .br
  569. change mask ?  xyz
  570. .br
  571. .in -10
  572.  
  573. will change  abc to xyz in all lines from 100 to 300.
  574. Thus, the line:
  575.  
  576. .ti +10
  577. know your abc's.
  578.  
  579. would be changed into:
  580.  
  581. .ti +10
  582. know your xyz's.
  583.  
  584. Only the first instance of abc on each line would be changed.
  585. The line:
  586.  
  587. .ti +10
  588. know your abc's.  The abc's are very important.
  589.  
  590. would be changed to:
  591.  
  592. .ti +10
  593. know your xyz's.  The abc's are very important.
  594.  
  595. .ti +3
  596. Question marks may be used in both the search mask and
  597. the change mask.
  598. A question mark in the search mask matches any character at
  599. all.
  600. The search mask:
  601.  
  602. .ti +10
  603. 12?34
  604.  
  605. will match any string of five characters which starts with
  606. 12 and ends with 34.
  607. A question mark in the change mask matches the letter that
  608. matched the corresponding question mark in the search mask.
  609. For example:
  610.  
  611. .in +10
  612. change 99 109
  613. .br
  614. search mask ?  trailing?
  615. .br
  616. change mask ?  ?leading
  617. .br
  618. .in -10
  619.  
  620. would change the line:
  621.  
  622. .ti +10
  623. trailingA
  624.  
  625. into the line:
  626.  
  627. .ti +10
  628. Aleading
  629.  
  630. The question mark in the search mask matched the 'A', so the
  631. quesion mark in the change mask became an 'A'.
  632. You can use as many question marks as you like, but there
  633. must be at least as many question marks in the search mask
  634. as there are in the change mask.
  635. As another example:
  636.  
  637. .in +10
  638. change
  639. .br
  640. search mask ?  wh??e
  641. .br
  642. change mask ?  fath??
  643. .br
  644. .in -10
  645.  
  646. would change the line:
  647.  
  648. .ti +10
  649. where is here.
  650.  
  651. to the line:
  652.  
  653. .ti +10
  654. father is here.
  655.  
  656. .ti +3
  657. If the first character of the search mask is an up arrow
  658. (^),
  659. the search mask is anchored to the start of the line.
  660. In other words, the search mask will only match patterns
  661. which start at column 0.
  662. For example, the search mask
  663.  
  664. .ti +10
  665. ^abc
  666.  
  667. will only match lines that contain abc
  668. in columns 0, 1 and 2.
  669. Anchoring the search mask dramatically increases the speed of
  670. the change command.
  671.  
  672. .ti +3
  673. An up arrow which is not the first character of the
  674. search mask is treated as a regular up arrow.
  675. An up arrow in the change mask never has any special
  676. significance.
  677.  
  678. clear
  679.  
  680. .ti +3
  681. The clear command erases the entire buffer.
  682. If you have not saved the buffer you will be asked whether
  683. you want to proceed.
  684.  
  685. delete <line range>
  686.  
  687. .ti +3
  688. The delete command erases all lines in the line range.
  689. Care must be used with this command because no check is
  690. made to see whether the buffer has been saved.
  691.  
  692. dos
  693.  
  694. .ti +3
  695. The dos command exits the editor and returns to the
  696. operating system.
  697. If the buffer has not been saved, this command makes sure
  698. that you really wanted to exit without saving the buffer.
  699.  
  700. find
  701.  
  702. .ti +3
  703. The find command searches for the next occurence of a
  704. search mask.
  705. If the search mask is found, the editor switches to edit mode
  706. and the cursor is set to the start of the pattern.
  707. If the search mask is not found the editor remains
  708. in command mode.
  709.  
  710. .ti +3
  711. You specify the search mask exactly as in the change command.
  712.  
  713. g <n>
  714.  
  715. .ti +3
  716. The g command exits to edit mode.
  717. Line <n> is drawn on the top line of the window and
  718. becomes the current line.
  719. Typing g without the <n> is the same as typing the 
  720. edit key.
  721.  
  722. list <line range>
  723.  
  724. .ti +3
  725. The list command lists all lines in the line range to
  726. the current list device, i.e., the printer.
  727. Lines are formatted just as they are on the screen, but
  728. the length of the print line, not the width of the screen,
  729. determines where lines will be truncated if they are too long.
  730. Listing may be stopped at any time by typing any key.
  731.  
  732. load <filename>
  733.  
  734. .ti +3
  735. The load command replaces whatever is in the buffer
  736. by the contents of the named file.
  737. If the buffer has not been saved on disk when the load
  738. command is given, the editor makes sure you really wanted
  739. to erase the previous contents of the buffer.
  740. If the named file exists, then <filename>
  741. becomes "the current file" and <filename>
  742. is shown on the prompt line.
  743. This file becomes the file used in the save and resave
  744. commands.
  745. The current file name does not change
  746. if the named file does not exist.
  747.  
  748. .ti +3
  749. After the file has been completely read from the disk
  750. into the buffer the screen is redrawn to show the
  751. first several lines of file.
  752.  
  753. name <filename>
  754.  
  755. .ti +3
  756. The name command sets the name of the file that will be used
  757. in the save and resave commands.
  758. This command is not often used because the load command
  759. is the usual way to set this file's name.
  760. The name command does not cause any action immediately;
  761. it simply affects which file the save and resave commands
  762. will use.
  763.  
  764. resave
  765.  
  766. .ti +3
  767. The resave command saves the entire buffer in the
  768. current file.
  769. The current file is set by either the load or name commands
  770. and always appears on the prompt line.
  771. Note that this command does
  772. .ul
  773. not
  774. take any arguments.
  775. All arguments to this command are ignored.
  776.  
  777. .ti +3
  778. The resave command requires that the current file already
  779. exist;
  780. if the file does not exist a warning is printed and nothing
  781. happens.
  782.  
  783. save
  784.  
  785. .ti +3
  786. The save command works just like the resave command
  787. except that the file must
  788. .ul
  789. not
  790. exist for the command to work.
  791. If the file does exist a warning is printed and
  792. nothing happens.
  793. This protection insures that files can not be overwritten
  794. inadvertantly.
  795.  
  796. search <line range>
  797.  
  798. .ti +3
  799. The search command prints on the
  800. screen all lines in <line range>
  801. which contain an instance of the search mask.
  802. As soon as the search command is typed the editor will ask:
  803.  
  804. .ti +10
  805. search mask ?
  806.  
  807. Now type the search mask.
  808. Just as in the change command, a question mark matches
  809. any character and a leading up arrow anchors
  810. the search mask to the start of the line.
  811.  
  812. tabs <n>
  813.  
  814. .ti +3
  815. The tabs command controls how lines are listed on the
  816. screen and on the printer.
  817. Specifically, the tabs command sets tab stops every
  818. <n> columns.
  819. <n> must be an integer.
  820. tabs 0 is equivalent to tabs 1.
  821.  
  822.  
  823.